package com.hmall.search;

import com.hmall.common.dto.PageDTO;
import com.hmall.common.dto.SearchFilterDTO;
import com.hmall.common.pojo.Item;
import com.hmall.common.vo.FilterParamVo;
import com.hmall.fign.client.ItemClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * x
 *
 * @Description SearchController
 * @Author kzw
 * @Date 2024-11-14
 */
@RestController
@RequestMapping("/search")
public class SearchController {
    @Autowired
    private ItemClient itemClient;

    /**
     * 过滤项聚合服务
     * @param filterParamVo
     * @return
     */
    @PostMapping("/filters")
    public SearchFilterDTO searchFilter(@RequestBody FilterParamVo filterParamVo){
        return itemClient.search(filterParamVo);
    }

    @PostMapping("/list")
    public PageDTO<Item> search(@RequestBody FilterParamVo filterParamVo){
        return itemClient.searchListItem(filterParamVo);
    }
}